<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8">
<title>模拟配置管理 |模拟新增配置管理</title>
<@fm.header />
<style>
.provinceClass label {
	font-size: 12px;
	float:left;
	margin:2px;
	width:80px;
	height:20px;
}
</style>
</head>
<body>
<div class="easyui-layout" style="text-align: center; height: 270px;" fit="true">
	<div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
	<form id="ff" method="post" enctype="multipart/form-data">
	<input type="hidden" name="useful"   value=${config.useful}></input>
	<input type="hidden" name="id"   value=${config.id}></input>
	    <table>
	         <tr>
	            <td><label for="accountName">公众号</label></td>
	            <td><input class="easyui-validatebox" type="text" name="accountName" style="width:300px" value=${config.accountName} ></input></td>
</tr>
	         <tr>
	            <td><label for="articleName">文章名称</label></td>
	            <td><input class="easyui-validatebox" type="text" name="articleName" style="width:300px" value=${config.articleName} ></input></td>
	        </tr>
	         <tr>
	            <td><label for="url">url</label></td>
	            <td><input class="easyui-validatebox"  type="text" name="url" data-options="validType:'url'" style="width:300px" value=${config.url} ></input></td>
	            </tr>
	         <tr>
	            <td><label for="keyword">关键字</label></td>
	            <td><input class="easyui-validatebox"  type="text" name="keyword" style="width:300px" value=${config.keyword} ></input></td>
	        </tr>
	        
	         <tr>
	            <td><label for="maxTimes">最大次数</label></td>
	            <td><input class="easyui-validatebox"  type="text" name="maxTimes" style="width:300px" value=${config.maxTimes} ></input></td>
	            </tr>
	         <tr>
	            <td><label for="dayLimit">日限</label></td>
	            <td><input class="easyui-validatebox"  type="text" name="dayLimit" style="width:300px" value=${config.dayLimit} ></input></td>
	        </tr>
	        
	        <tr>
	            <td><label for="mark">对应微信mark</label></td>
	            <td><input class="easyui-validatebox"  type="text" name="mark" colspan="3" style="width:300px" value=${config.mark} ></input></td>
	            </tr>
	         <tr>
	            
	            <td><label for="taskType">任务类型</label></td>
	            <td> <select class="easyui-combobox" name="taskType" panelHeight="auto" style="width:155px"  value=${config.taskType} data-options="required:true">
		                <option value="1"<#if config.taskType?exists && config.taskType == 1>selected</#if>>关注</option>
	                	<option value="2"<#if config.taskType?exists && config.taskType == 2>selected</#if>>投票</option>
	                	<option value="3"<#if config.taskType?exists && config.taskType == 3>selected</#if>>阅读</option>
		            </select>
	    	 	</td>
	        </tr> 
	         
	    </table>
	</form>
	</div>
	<div region="south" border="false" style="text-align: center; padding: 5px 5px 5px 0;">
	    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="edit()">提交</a>
	</div>
</div>

<script>

function edit() {
	
	$('#ff').form(
	    'submit',
	    {
			url : '/weixinTaskConfig/updateConfig',
			onSubmit : function() {
				return $(this).form('enableValidation').form('validate');
			},
			success : function(data) {
				showProcess(false);
				var data = eval('(' + data + ')');
				if (data.return_code == '1') {
					top.showMsg(market.content.title, data.return_msg, alert);
					if (parent !== undefined) {
						if ($.isFunction(parent.reloadParent)) {
							parent.reloadParent.call();
							parent.closeMyWindow();
						} else {
							parent.$("#tt").datagrid('reload');
							parent.closeMyWindow();
						}
					}
				}else if(data.return_code == '10'){
					$.messager.alert(market.content.title, data.return_msg);
					if (parent !== undefined) {
						if ($.isFunction(parent.reloadParent)) {
							parent.reloadParent.call();
							parent.closeMyWindow();
						} else {
							parent.$("#tt").datagrid('reload');
							parent.closeMyWindow();
						}
					}
				} else {
					$.messager.alert(market.content.title, data.return_msg);
				}
			},
			onLoadError : function() {
				showProcess(false);
				$.messager.alert(market.content.title, market.content.networkError);
			}
		}); 
}
</script>
</body>
</html>